﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
@this.Partial("Index-js")
<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$ace.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <button class="btn btn-primary" data-bind="click:Edit,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>修改</button>
            <button class="btn btn-primary" data-bind="click:Delete,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-trash-o"></i>删除</button>
            <button class="btn btn-primary" data-bind="click:Add"><i class="fa fa-plus"></i>添加</button>
        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="网名" style="width: 200px;" data-bind="value:SearchModel().keyword">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" data-bind="click:Search"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>

<div class="table-responsive">
    <table class="table table-bordered" data-bind="with:DataTable">
        <thead>
            <tr>
                <th style="width:20px;"></th>
                <th>姓名</th>
                <th>网名</th>
                <th>身份证</th>
                <th>性别</th>
                <th>生日</th>
                <th>手机号码</th>
                <th>会员</th>
                <th>微信</th>
                <th>创建时间</th>
                <th>备注</th>
            </tr>
        </thead>
        <tbody data-bind="foreach:Models">
            <tr data-bind="click:$parent.SelectRow">
                <td data-bind="text:$parent.GetOrdinal($index())"></td>
                <td data-bind="text:Name"></td>
                <td data-bind="text:OnlineName"></td>
                <td data-bind="text:IdNumber"></td>
                <td data-bind="text:(Gender()==1&&'男')||(Gender()==2&&'女')||''"></td>
                <td data-bind="dateString:Birthday"></td>
                <td data-bind="text:MobilePhone"></td>
                <td data-bind="text:(IsMember()==1&&'是')||(IsMember()==2&&'否')||''"></td>
                <td data-bind="text:WeChat"></td>
                <td data-bind="dateString:CreationTime"></td>
                <td data-bind="text:Description"></td>
            </tr>
        </tbody>
    </table>
</div>

@using (Html.Dialog())
{
    <form id="form1">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form">
                    <tr>
                        <td class="formTitle">姓名</td>
                        <td class="formValue">
                            <input id="Name" name="Name" type="text" class="form-control required" placeholder="请输入姓名" data-bind="value:Model().Name" />
                        </td>
                        <td class="formTitle">网名</td>
                        <td class="formValue">
                            <input id="OnlineName" name="OnlineName" type="text" class="form-control required" placeholder="请输入网名" data-bind="value:Model().OnlineName" />
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">身份证</td>
                        <td class="formValue">
                            <input id="IdNumber" name="IdNumber" type="text" class="form-control" data-bind="value:Model().IdNumber" />
                        </td>
                        <td class="formTitle">性别</td>
                        <td class="formValue">
                            <select id="Gender" name="Gender" class="form-control required" data-bind="value:Model().Gender">
                                <option value="">--请选择--</option>
                                <option value="1">男</option>
                                <option value="2">女</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">生日</td>
                        <td class="formValue">
                            <input id="Birthday" name="Birthday" type="text" class="form-control input-wdatepicker Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" data-bind="dateString:Model().Birthday" />
                        </td>
                        <td class="formTitle">手机号码</td>
                        <td class="formValue">
                            <input id="MobilePhone" name="MobilePhone" type="text" class="form-control" data-bind="value:Model().MobilePhone" />
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">会员</td>
                        <td class="formValue">
                            <select id="IsMember" name="IsMember" class="form-control required" data-bind="value:Model().IsMember">
                                <option value="">--请选择--</option>
                                <option value="1">是</option>
                                <option value="2">否</option>
                            </select>
                        </td>
                        <td class="formTitle">微信</td>
                        <td class="formValue">
                            <input id="WeChat" name="WeChat" type="text" class="form-control" data-bind="value:Model().WeChat" />
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle" valign="top" style="padding-top: 5px;">
                            备注
                        </td>
                        <td class="formValue" colspan="3">
                            <textarea id="Description" name="Description" class="form-control" style="height: 60px;" data-bind="value:Model().Description"></textarea>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
}